package com.manong.controller;

import com.manong.entity.SysNotice;
import com.manong.service.SysNoticeService;
import com.manong.utils.Result;
import com.manong.vo.CommonReqVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/notice")
public class SysNoticeController {

    private final SysNoticeService sysNoticeService;

    @PostMapping("/list")
    public Result list(@RequestBody CommonReqVo commonReqVo) {
        return Result.ok(sysNoticeService.listAll(commonReqVo)).message("公告信息查询成功");
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody CommonReqVo commonReqVo) {
        return Result.ok(sysNoticeService.delete1(commonReqVo)).message("公告信息删除成功");
    }

    @PostMapping("/save")
    public Result save(@RequestBody SysNotice sysNotice) {
        return Result.ok(sysNoticeService.save1(sysNotice)).message("公告信息更新成功");
    }

}
